/*
 *-----------------------------------------------------------------------------
 * Copyright 2012 NCR Corporation
 *-----------------------------------------------------------------------------
 * All revision information is updated automatically from source code control
 * change records - please do not manually edit.
 *-----------------------------------------------------------------------------
 *
 *-----------------------------------------------------------------------------
 * $LastChangedRevision:: 4185                                      $
 * $LastChangedBy:: rc250130                                        $
 * $LastChangedDate:: 2012-04-30 16:29:02 -0400 (Mon, 30 Apr 2012)  $
 *-----------------------------------------------------------------------------
 */
package com.ncr.travel.airline.shared.configuration.converters;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Stub implementation of airport-country mapping for testing.
 * 
 * @author ms185252
 * @version $Revision: 4185 $
 * @since  <a href="http://jira.sweng.ncr.com/browse/[current_issue_number]">[Project/effort name] Project</a>
 */
public class AirportCountryMapperStubImpl implements AirportCountryMapper {

	private static final Logger logger = LoggerFactory.getLogger(AirportCountryMapper.class);
	private final Map<String, String> airportCountryMappings;

	public AirportCountryMapperStubImpl() {
		airportCountryMappings = new HashMap<String, String>();

		// FIXME: This needs to be pulled from the config service.
		loadStubData();
	}

	@Override
	public String getAirportCountry(String airportCode) {
		String countryCode = airportCountryMappings.get(airportCode);
		if (countryCode == null) {
			logger.warn("Airport \"" + airportCode + "\" is not mapped to a country.");
		}

		return countryCode;
	}

	private void loadStubData() {
		CountryCodeConverter converter = new CountryCodeConverterStubImpl();
		airportCountryMappings.put("ADZ", converter.convertIsoAlpha2ToAlpha3("CO"));
		airportCountryMappings.put("ASU", converter.convertIsoAlpha2ToAlpha3("PY"));
		airportCountryMappings.put("AUA", converter.convertIsoAlpha2ToAlpha3("AW"));
		airportCountryMappings.put("BAQ", converter.convertIsoAlpha2ToAlpha3("CO"));
		airportCountryMappings.put("BGA", converter.convertIsoAlpha2ToAlpha3("CO"));
		airportCountryMappings.put("BOG", converter.convertIsoAlpha2ToAlpha3("CO"));
		airportCountryMappings.put("BSB", converter.convertIsoAlpha2ToAlpha3("BR"));
		airportCountryMappings.put("CCS", converter.convertIsoAlpha2ToAlpha3("VE"));
		airportCountryMappings.put("CLO", converter.convertIsoAlpha2ToAlpha3("CO"));
		airportCountryMappings.put("CNF", converter.convertIsoAlpha2ToAlpha3("BR"));
		airportCountryMappings.put("COR", converter.convertIsoAlpha2ToAlpha3("AR"));
		airportCountryMappings.put("CTG", converter.convertIsoAlpha2ToAlpha3("CO"));
		airportCountryMappings.put("CUC", converter.convertIsoAlpha2ToAlpha3("CO"));
		airportCountryMappings.put("CUN", converter.convertIsoAlpha2ToAlpha3("MX"));
		airportCountryMappings.put("CUR", converter.convertIsoAlpha2ToAlpha3("AN"));
		airportCountryMappings.put("EZE", converter.convertIsoAlpha2ToAlpha3("AR"));
		airportCountryMappings.put("GDL", converter.convertIsoAlpha2ToAlpha3("MX"));
		airportCountryMappings.put("GIG", converter.convertIsoAlpha2ToAlpha3("BR"));
		airportCountryMappings.put("GRU", converter.convertIsoAlpha2ToAlpha3("BR"));
		airportCountryMappings.put("GUA", converter.convertIsoAlpha2ToAlpha3("GT"));
		airportCountryMappings.put("GYE", converter.convertIsoAlpha2ToAlpha3("EC"));
		airportCountryMappings.put("HAV", converter.convertIsoAlpha2ToAlpha3("CU"));
		airportCountryMappings.put("IAD", converter.convertIsoAlpha2ToAlpha3("US"));
		airportCountryMappings.put("JFK", converter.convertIsoAlpha2ToAlpha3("US"));
		airportCountryMappings.put("KIN", converter.convertIsoAlpha2ToAlpha3("JM"));
		airportCountryMappings.put("LAS", converter.convertIsoAlpha2ToAlpha3("US"));
		airportCountryMappings.put("LAX", converter.convertIsoAlpha2ToAlpha3("US"));
		airportCountryMappings.put("LET", converter.convertIsoAlpha2ToAlpha3("CO"));
		airportCountryMappings.put("LIM", converter.convertIsoAlpha2ToAlpha3("PE"));
		airportCountryMappings.put("LIR", converter.convertIsoAlpha2ToAlpha3("CR"));
		airportCountryMappings.put("MAO", converter.convertIsoAlpha2ToAlpha3("BR"));
		airportCountryMappings.put("MAR", converter.convertIsoAlpha2ToAlpha3("VE"));
		airportCountryMappings.put("MBJ", converter.convertIsoAlpha2ToAlpha3("JM"));
		airportCountryMappings.put("MCO", converter.convertIsoAlpha2ToAlpha3("US"));
		airportCountryMappings.put("MDE", converter.convertIsoAlpha2ToAlpha3("CO"));
		airportCountryMappings.put("MEX", converter.convertIsoAlpha2ToAlpha3("MX"));
		airportCountryMappings.put("MGA", converter.convertIsoAlpha2ToAlpha3("NI"));
		airportCountryMappings.put("MIA", converter.convertIsoAlpha2ToAlpha3("US"));
		airportCountryMappings.put("MTR", converter.convertIsoAlpha2ToAlpha3("CO"));
		airportCountryMappings.put("MTY", converter.convertIsoAlpha2ToAlpha3("MX"));
		airportCountryMappings.put("MVD", converter.convertIsoAlpha2ToAlpha3("UY"));
		airportCountryMappings.put("NAS", converter.convertIsoAlpha2ToAlpha3("BS"));
		airportCountryMappings.put("ORD", converter.convertIsoAlpha2ToAlpha3("US"));
		airportCountryMappings.put("PAP", converter.convertIsoAlpha2ToAlpha3("HT"));
		airportCountryMappings.put("PEI", converter.convertIsoAlpha2ToAlpha3("CO"));
		airportCountryMappings.put("POA", converter.convertIsoAlpha2ToAlpha3("BR"));
		airportCountryMappings.put("POS", converter.convertIsoAlpha2ToAlpha3("TT"));
		airportCountryMappings.put("PTY", converter.convertIsoAlpha2ToAlpha3("PA"));
		airportCountryMappings.put("PUJ", converter.convertIsoAlpha2ToAlpha3("DO"));
		airportCountryMappings.put("REC", converter.convertIsoAlpha2ToAlpha3("BR"));
		airportCountryMappings.put("SAL", converter.convertIsoAlpha2ToAlpha3("SV"));
		airportCountryMappings.put("SAP", converter.convertIsoAlpha2ToAlpha3("HN"));
		airportCountryMappings.put("SCL", converter.convertIsoAlpha2ToAlpha3("CL"));
		airportCountryMappings.put("SDQ", converter.convertIsoAlpha2ToAlpha3("DO"));
		airportCountryMappings.put("SJO", converter.convertIsoAlpha2ToAlpha3("CR"));
		airportCountryMappings.put("SJU", converter.convertIsoAlpha2ToAlpha3("PR"));
		airportCountryMappings.put("SMR", converter.convertIsoAlpha2ToAlpha3("CO"));
		airportCountryMappings.put("STI", converter.convertIsoAlpha2ToAlpha3("DO"));
		airportCountryMappings.put("SXM", converter.convertIsoAlpha2ToAlpha3("AN"));
		airportCountryMappings.put("TGU", converter.convertIsoAlpha2ToAlpha3("HN"));
		airportCountryMappings.put("UIO", converter.convertIsoAlpha2ToAlpha3("EC"));
		airportCountryMappings.put("VLN", converter.convertIsoAlpha2ToAlpha3("VE"));
		airportCountryMappings.put("VVI", converter.convertIsoAlpha2ToAlpha3("BO"));
		airportCountryMappings.put("YYZ", converter.convertIsoAlpha2ToAlpha3("CA"));

	}
}